home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_11_03
/
1103108a
< prev
next >
Wrap
Text File
|
1993-01-06
|
527b
|
49 lines
#include <iostream.h>
class B
{
public:
void f();
void g();
void h();
};
void B::f() { cout << "B::f()\n"; }
void B::g() { cout << "B::g()\n"; }
void B::h() { cout << "B::h()\n"; }
class D : public B
{
public:
void g();
void h();
};
void D::g()
{
B::g();
cout << "... called from D::g()\n";
}
void D::h()
{
((B *)(this))->h();
cout << "... called from D::h()\n";
}
int main()
{
B b;
b.f();
b.g();
b.h();
D d;
d.f();
d.g();
d.h();
return 0;
}